package office.pdf;

import org.apache.poi.xwpf.usermodel.XWPFDocument;

import fr.opensagres.poi.xwpf.converter.pdf.PdfConverter;
import fr.opensagres.poi.xwpf.converter.pdf.PdfOptions;
import org.apache.poi.xwpf.usermodel.XWPFDocument;

import java.io.*;

public class Test {

    public static void main(String[] args) throws IOException {
        long start = System.currentTimeMillis();
        String docPath = "D:\\codespace\\alldemo\\java-test-project\\templates\\信息技术中心建党百年庆祝活动生产服务保障工作回顾总结报告.docx";
        String pdfPath = "信息技术中心建党百年庆祝活动生产服务保障工作回顾总结报告.pdf";

        XWPFDocument document;
        InputStream doc = new FileInputStream(docPath);
        document = new XWPFDocument(doc);
        PdfOptions options = PdfOptions.create();
        OutputStream out = new FileOutputStream(pdfPath);
        PdfConverter.getInstance().convert(document, out, options);

        doc.close();
        out.close();
        long end = System.currentTimeMillis();
        System.out.println(end - start);

    }

}
